extends Area2D

@export var speed := -250

func start(pos):
	position = pos

func _ready() -> void:
	pass 

func _process(delta: float) -> void:
	position += Vector2(0,speed*delta)

#检测到碰撞掉用对方的explode方法，并销毁自己
func _on_area_entered(area: Area2D) -> void:
	if area.is_in_group("enemies"):
		area.explode()
		queue_free()

# 不在屏幕中销毁
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
	queue_free()
